1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.google.common.collect.testing.features;
18
19 import com.google.common.annotations.GwtCompatible;
20 import com.google.common.collect.testing.Helpers;
21
22 import java.lang.annotation.Inherited;
23 import java.lang.annotation.Retention;
24 import java.lang.annotation.RetentionPolicy;
25 import java.util.List;
26 import java.util.Set;
27
28
29
30
31
32
33
34 @SuppressWarnings("unchecked")
35 @GwtCompatible
36 public enum ListFeature implements Feature<List> {
37 SUPPORTS_SET,
38 SUPPORTS_ADD_WITH_INDEX(CollectionFeature.SUPPORTS_ADD),
39 SUPPORTS_REMOVE_WITH_INDEX(CollectionFeature.SUPPORTS_REMOVE),
40
41 GENERAL_PURPOSE(
42 CollectionFeature.GENERAL_PURPOSE,
43 SUPPORTS_SET,
44 SUPPORTS_ADD_WITH_INDEX,
45 SUPPORTS_REMOVE_WITH_INDEX
46 ),
47
48
49 REMOVE_OPERATIONS(
50 CollectionFeature.REMOVE_OPERATIONS,
51 SUPPORTS_REMOVE_WITH_INDEX
52 );
53
54 private final Set<Feature<? super List>> implied;
55
56 ListFeature(Feature<? super List> ... implied) {
57 this.implied = Helpers.copyToSet(implied);
58 }
59
60 @Override
61 public Set<Feature<? super List>> getImpliedFeatures() {
62 return implied;
63 }
64
65 @Retention(RetentionPolicy.RUNTIME)
66 @Inherited
67 @TesterAnnotation
68 public @interface Require {
69 ListFeature[] value() default {};
70 ListFeature[] absent() default {};
71 }
72 }